agents.anac.y2011.TheNegotiator
Class BidsCollection

java.lang.Object
  extended by agents.anac.y2011.TheNegotiator.BidsCollection

public class BidsCollection
extends java.lang.Object

The BidsCollection class stores the bids of the partner and all possible bids.

Author:
Alex Dirkzwager, Mark Hendrikx, Julian de Ruiter

Constructor Summary
BidsCollection()
          Creates a BidsCollection-object which stores the partner bids and all possible bids.
 
Method Summary
 void addPartnerBid(Bid bid, double utility, double time)
          Add a partner bid to the history.
 void addPossibleBid(Bid bid, double utility)
          Add a possible bid to the list of possible bids.
 Bid getBestPartnerBids(double threshold)
          Get a partner bid which has a utility of at least a certain value.
 Bid getOwnBidBetween(double lowerThres, double upperThres)
           
 Bid getOwnBidBetween(double lowerThres, double upperThres, int counter)
          Get a random bid between two given thresholds.
 Bid getPartnerBid(int i)
          Get a partner bid.
 java.util.ArrayList<BidDetails> getPartnerBids()
           
 java.util.ArrayList<BidDetails> getPossibleBids()
           
 double getUpperThreshold(double threshold, double percentage)
          Calculate the upperthreshold based on the lowerthreshold and a given percentage.
 void sortPossibleBids()
          Sorts all possible bids in reverse natural order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BidsCollection

public BidsCollection()
Creates a BidsCollection-object which stores the partner bids and all possible bids.

Method Detail

getPartnerBids

public java.util.ArrayList<BidDetails> getPartnerBids()
Returns:
the partnerBids

getPossibleBids

public java.util.ArrayList<BidDetails> getPossibleBids()
Returns:
the possibleBids

addPartnerBid

public void addPartnerBid(Bid bid,
                          double utility,
                          double time)
Add a partner bid to the history. Bids are stored at the front to preserve the timeline.

Parameters:
bid - made by partner in the current turn
utility - of the bid

addPossibleBid

public void addPossibleBid(Bid bid,
                           double utility)
Add a possible bid to the list of possible bids. The given bid should not violate the constraints of the negotiation.

Parameters:
bid - which is possible
utility - of the bid

sortPossibleBids

public void sortPossibleBids()
Sorts all possible bids in reverse natural order.


getPartnerBid

public Bid getPartnerBid(int i)
Get a partner bid.

Parameters:
i -
Returns:
the i'th bid in the timeline

getBestPartnerBids

public Bid getBestPartnerBids(double threshold)
Get a partner bid which has a utility of at least a certain value. Null is returned if no such bid exists.

Parameters:
threshold -
Returns:
bid with utility > threshold if exists

getOwnBidBetween

public Bid getOwnBidBetween(double lowerThres,
                            double upperThres)

getOwnBidBetween

public Bid getOwnBidBetween(double lowerThres,
                            double upperThres,
                            int counter)
Get a random bid between two given thresholds.

Parameters:
lowerThres - lowerbound threshold
upperThres - upperbound threshold
Returns:
random bid between thresholds

getUpperThreshold

public double getUpperThreshold(double threshold,
                                double percentage)
Calculate the upperthreshold based on the lowerthreshold and a given percentage.

Parameters:
threshold -
percentage -
Returns: